package com.xmall.order.service.remote;

import com.xmall.define.base.Result;
import com.xmall.define.dto.product.SkuInfoDto;
import com.xmall.define.dto.product.SkuQuantity;
import com.xmall.define.request.product.StockLockRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 微服务 - product：product
 */
@FeignClient(value = "xmall-product")
public interface ProductServiceFeign {

    /**
     * 根据skuID列表查询sku列表（包含属性）
     */
    @PostMapping("/service/product/sku/list")
    Result<List<SkuInfoDto>> list(@RequestBody List<Long> skuIds);

    /**
     * 库存检查（返回不通过的skuId列表）
     */
    @PostMapping("/service/product/sku/stockCheck")
    Result<List<Long>> stockCheck(@RequestBody List<SkuQuantity> skuQuantityList);

    /**
     * 库存锁定
     */
    @PostMapping("/service/product/sku/stockLock")
    Result stockLock(@RequestBody StockLockRequest request);

}
